
const {
    baseUrl,
    isHaveToken,
    isHaveLogin
} = require("../../../utils/util")
Page({

    /**
     * 页面的初始数据
     */
    data: {
        userId: "",
        userInfo: {},
        visible: false,
        showIndex: false,
        closeBtn: false,
        deleteBtn: false,
        images: [],
    },
    clickHandle() {
        // console.log("dasdf", this.data.userInfo)
        this.setData({
            images: [this.data.userInfo.avatar],
            showIndex: true,
            visible: true,
        });
    },
    onChange(e) {
        const {
            detail: { index },
        } = e;
        Toast({
            context: this,
            selector: '#t-toast',
            message: `翻到第${index + 1}个`,
        });
    },

    onDelete(e) {
        const {
            detail: { index },
        } = e;
        Toast({
            context: this,
            selector: '#t-toast',
            message: `删除第${index + 1}个`,
        });
    },

    onClose(e) {
        const {
            detail: { trigger },
        } = e;
        if (trigger === 'overlay') {
            Toast({
                context: this,
                selector: '#t-toast',
                message: '点击overlay关闭',
            });
        } else if (trigger === 'button') {
            Toast({
                context: this,
                selector: '#t-toast',
                message: `点击button关闭`,
            });
        }
        this.setData({
            visible: false,
        });
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            userId: options.id
        })
        var that = this
        wx.request({
            url: `${baseUrl}/ucenter/member/getUserInfo/${that.data.userId}`,
            method: 'GET',
            success(res) {
                console.log(res)
                that.setData({
                    userInfo: res.data
                })
            }
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})